#ifndef __CURTISENCODER_H
#define __CURTISENCODER_H

#include "rclcpp/rclcpp.hpp"
#include <string>
#include <encoder/encoder.h>
#include <comm/sensor.h>
#include <std_msgs/msg/u_int64.hpp>
#include <std_msgs/msg/float64.hpp>


namespace encoder {

class CurtisEncoder : public Encoder
{
public:
    CurtisEncoder(std::shared_ptr<rclcpp::Node> node, const std::string joint_name);
    ~CurtisEncoder();

    void     init();
    uint64_t getValue();
    int64_t  getTurns();
    double   getRadValue();
    void     runService(boost::asio::io_service *service);
    void     enc_sub_callback(const std_msgs::msg::UInt64::ConstSharedPtr& msg);
    void     timestamp_sub_callback(const std_msgs::msg::Float64::ConstSharedPtr& msg);


private:
    int                     looprate;
    int                     connectionType;
    std::shared_ptr<Sensor::Communication> commPtr;
    union   ConnetionParam  cparam;
    std::string             host_name;
    rclcpp::Subscription<std_msgs::msg::UInt64>::SharedPtr    enc_sub_;
    rclcpp::Subscription<std_msgs::msg::Float64>::SharedPtr   timestamp_sub_;
    uint64_t                raw_value_;

    std::shared_ptr<rclcpp::Node> node_;
};



}



#endif